package com.zzr.zzrbackend.util;


import org.apache.tomcat.util.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *  MD5工具
 */
public class MD5Utils {
    public static final String SALT = "*fdsvkljd&SHDFEKfEW03";

    public static String getMD5Str(String strValue) throws NoSuchAlgorithmException {
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        return Base64.encodeBase64String(md5.digest((strValue + SALT).getBytes()));
    }

    public static void main(String[] args) throws NoSuchAlgorithmException {
        String password = MD5Utils.getMD5Str("123456");
        System.out.println(password);
    }
}
